import {createRouter, createWebHistory} from 'vue-router'
import i18n from "@/locale/index";

const {tm} = i18n.global
const routes = [
    {
        path: '/',
        redirect: '/home/index'
    },
    {
        path: '/login',
        component: () => import('@/components/Login'),
    },
    {
        path: '/processContent',
        meta: {
            keepAlive: true,
            title: '内容'
        },
        component: () => import('@/components/processContent/index'),
        children: [


            // {
            //     //虚拟卡支付
            //     path: '/extend',
            //     meta:{
            //         keepAlive: true,
            //         title:tm('add_bank_card')
            //     },
            //     component: () => import('@/views/order/extend/index'),
            // },

        ]
    },
    // 身份认证
    {
        path: '/identityInfo',
        meta: {
            keepAlive: true,
            title: tm('identity_auth')
        },
        component: () => import('@/views/identityInfo/index'),
    },

    // 个人信息
    {
        path: '/personalInfo',
        meta: {
            keepAlive: true,
            title: tm('personal_info')
        },
        component: () => import('@/views/personalInfo/index'),
    },
    // 工作信息
    {
        path: '/workInfo',
        meta: {
            keepAlive: true,
            title: tm('work_info')
        },
        component: () => import('@/views/workInfo/index'),
    },
    //联系人信息
    {
        path: '/contactsInfo',
        meta: {
            keepAlive: true,
            title: tm('contact_info')
        },
        component: () => import('@/views/contactsInfo/index'),
    },
    //运营商授权
    {
        path: '/operatorsAuth',
        meta: {
            keepAlive: true,
            title: tm('operator_auth')
        },
        component: () => import('@/views/operatorsAuth/index'),
    },
    //运营商验证码
    {
        path: '/operatorCode',
        component: () => import('@/views/operatorsAuth/operatorCode/index'),
    },
    //添加银行卡信息
    {
        path: '/bankCardInfo',
        meta: {
            keepAlive: true,
            title: tm('add_bank_card')
        },
        component: () => import('@/views/bankCardInfo/index'),
    },
    //我的银行卡
    {
        path: '/myCard',
        meta: {
            keepAlive: true,
            title: tm('add_bank_card')
        },
        component: () => import('@/views/bankCardInfo/myCard/index'),
    },
    //补充信息
    {
        path: '/supplementInfo',
        meta: {
            keepAlive: true,
            title: tm('supplementary_information')
        },
        component: () => import('@/views/supplementInfo/index'),
    },
    //贷款信息
    {
        path: '/loanInfo',
        meta: {
            keepAlive: true,
            title: tm('loan_info_confirmation')
        },
        component: () => import('@/views/loanInfo/index'),
    },
    // 贷款成功
    {
        path: '/loanSuccess',
        meta: {
            keepAlive: true,
            title: tm('submit_success')
        },
        component: () => import('@/views/loanSuccess/index'),
    },
    // 首页
    {
        path: '/home',
        meta: {
            keepAlive: true
        },
        component: () => import('@/layout/index'),
        children: [
            {
                path: 'index',
                meta: {
                    keepAlive: true
                },
                component: () => import('@/views/home/index'),
            }
        ]
    },
    // 订单
    {
        path: '/order',
        component: () => import('@/layout/index'),
        children: [
            {
                path: 'index',
                meta: {
                    keepAlive: true
                },
                component: () => import('@/views/order/index'),
            },
        ]
    },


    {
        //订单详情
        path: '/orderDetails',
        meta: {
            keepAlive: true,
            title: tm('order_details')
        },
        component: () => import('@/views/order/orderDetails/index'),
    },
    {
        //支付确认
        path: '/repayment',
        meta: {
            keepAlive: true,
            title: tm('repayment_details')
        },
        component: () => import('@/views/order/repayment/index'),
    },
    {
        //展期
        path: '/extend',
        meta: {
            keepAlive: true,
            title: tm('delay')
        },
        component: () => import('@/views/order/extend/index'),
    },
    {
        //虚拟卡支付
        path: '/virtualCardPay',
        meta: {
            keepAlive: true,
            title: tm('repayment_virtual_card')
        },
        component: () => import('@/views/order/virtualCardPay/index'),
    },
    // 我的
    {
        path: '/my',
        component: () => import('@/layout/index'),
        children: [
            {
                path: 'index',
                component: () => import('@/views/my/index'),
            },
        ]
    },

    {
        //个人资料
        path: '/personalData',
        meta: {
            keepAlive: true,
            title: tm('personal_data')
        },
        component: () => import('@/views/my/personalData/index'),
    },
    {
        //设置
        path: '/mySet',
        meta: {
            keepAlive: true,
            title: tm('set')
        },
        component: () => import('@/views/my/set/index'),
    },
    {
        //问题反馈
        path: '/feedBack',
        meta: {
            keepAlive: true,
            title: tm('problem_feedback')
        },
        component: () => import('@/views/my/set/feedBack/index'),
    },
    {
        //
        //  关于我们
        path: '/aboutUs',
        meta: {
            keepAlive: true,
            title: tm('about_us')
        },
        component: () => import('@/views/my/set/aboutUs/index'),
    },
    // {
    //     //    关于我们
    //     path: '/swiper',
    //     meta:{
    //         keepAlive: true,
    //         title:tm('add_bank_card')
    //     },
    //     component: () => import('@/components/swiper/index'),
    // }
]
const routerHistory = createWebHistory()
const router = createRouter({
    history: routerHistory,
    routes: routes
})
export default router
